package com.wm.blog_web.controller;

import com.wm.blog_common.result.Result;
import com.wm.blog_config.Document.BlogDocument;
import com.wm.blog_web.controller.base.WebBaseController;
import com.wm.blog_web.feign.SearchFeignClient;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * @author ：半卷流年
 * @description : ${description}
 * @createTime ：2020/5/23
 */
@RestController
@RequestMapping("/es/test")
@Slf4j
public class TestEsController extends WebBaseController {

    @Autowired
    private SearchFeignClient searchFeignClient;

    /**
     * 查询所有
     * @return
     */
    @GetMapping("/getAll")
    public Result getAll(){
        Result<List<BlogDocument>> result = searchFeignClient.getAll();
        if(result.isSuccess()){
            log.info("查询到的数据:{}",result.getData());
        }
        return result;
    }

}
